package com.itheima.superclass;

import com.itheima.utils.Utils;

public abstract class Person {
    //成员属性
    private int id;
    private String name;
    private String sex;
    private String birthday;
    private int age;
    //构造方法
    public Person() {
    }
    public Person(int id, String name, String sex, String birthday) {
        this.id = id;
        this.name = name;
        this.sex = sex;
        this.birthday = birthday;
    }
    //get/set方法
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getBirthday() {
        return birthday;
    }

    public void setBirthday(String birthday) {
        this.birthday = birthday;
    }

    public int getAge() {
        age = Utils.birthdayToAge(birthday);
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }


    //重写toString（）
    public java.lang.String toString() {
        return id + "\t\t\t" +
                name + "\t\t" +
                sex + "\t\t\t" +
                birthday + "\t\t" +
                getAge() + "\t\t\t" +
                "我是一名" + getType() + "，我的工作是" + getWork();
    }
    //两个抽象方法，getType(),getWork()
    public abstract String getType();
    public abstract String getWork();

}
